package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118634078";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCwaasQ2rA/hK8fNgvRVl6r9zw99zfHFryQKcgZJWF+iGm/inBT5iRDlAd15Nt3uVfYK+6J/x6HyxUiOuc0wNx7luo7ksdkMLGO7hvGpJyGr1nskEltOhITLLUGExYsioWox4orzr4zlWK6b9VLT7uxaRxnl/nfhQFGuOFPZh8KHzifKDcBjMJBsb8yfTJ69FlOJY+umO1z+g9mwVsiqxTIFenysScmF63WaYPdu4uriEfpiSwPlKfeQHUdGp3+8ZnWmQ4JWXw/2YgVJOrfecVvG5gnGgrpXStYUX24m0nUBzL/curCUukjmn7cRn9mTjCIRC4uWxMopsffNw0Vg/VvAgMBAAECggEARdCLso/ZUEniRCfPZXkY3lVpsdw0ZsXIugTO+6SfgMPblcHj0lAx6cybZzy63harfRFlxZcBLhxgsLs+5NGub/q5l/nujuf2XOo+c86RY3vhyo0PgfqJTK1UtqK3E8l+O908ATpAa4mjGMVJVBSp4vwGEblDWgH5D1P7VsDDZ+1pj/urYafUhOo1lmLn+zGhTJH9gMcxUGizZce+i4tdlwohuMREnvntlf4cQiJhEdtUwpnDjXplsl0w+kDJFEJUkB1PFTv0rvW6+e4Q3A03uapfyM7/dJ5WIZOaFHWKNm5gckGHKHGr38A3RuHM+Bho9Mol0Z67Si1ppGJdOL+7AQKBgQDxxRsLK86vCsiZ3xI5bzQdYpWxb05H31Wix4RlDK8E5tBG3VFPEqxPVmLRfrjxRDDiEsDetFsOysUyz8Q8BgAVG0g7/Fsv6x1uy6t1KuOVj8lzD+vhGyPRkcBAhy8CdkBz2WHewyufzZxvqTba3zDrQYl5HHvbcXODHNn1feMqFwKBgQC6y8lO69ISJCFDpFnGXrnLLYsH6aYQ5Wbz+wqynlX9iWNmGFDd4xumW5ZjZ7WpNP+GZHUr9lRqC7bsKIXiyo7ihC4+DECwCILUv/0QiDpk3jHVnyrsVhAu+m3n/aBoabGsqjtvtVB2fTJr/ZeUer4wJEVDPv6EicoNJq/UhX8eaQKBgQCEI3F7co79NoybJMOGJpQ6N0aPesEzIQph9GAVBpClwi01fgLRj+gjWJib3YHhQ57gANXvIm3eMM8EzW94SuNCpe2d83g3QW6Nvr1QRYerl7HHtHz8RGQYR2vnGLuFwfHKH5aRNOSj67HDiZ2UlIXdHq2vRvUe4+v5TgyGUy6UMwKBgQC1BAi37zTqmZKWryzEXEVlzGOfrl9cnkHvi0Zpo6CnCj2F0WiELbI8uyJ4gCb9qzs37B/UE2joPyPrpLVh+nMOtZLuVAdXz1ehfc9p9unHl77pSc5ZqmkSbWKWXyTUKiCgt3LTpPwtZtO27M+4dl3Z3zwzl1cj7zcbGXNo2lk+iQKBgQClC7G348Twn3g7PErYNL4GRloDvfzKSTrCoKHJAsViI36Ppgu6/vzsLVivnxScnG31imWzmSmdkXkbftREzoEBzRUbVlnxA3J1efpMZlGwc8Px/6f9ETiiJgCRi3A8Vd6UKKTMZXK6bCL82Z/TwcdJ2bupEAER+Lcv6Rn8QbDQ8A==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApBzM5BZyiFhZ2daqECowpKuC4BUUI5I/V3lzLwUgGEfsTTEVtYrZHSjez/By9gS+XWyc29Xi6DdVU7kOKp5p5SRC9EQt9EgIUI5Jm/2oDRi2KTMNdFaYvAwoR0SYXHEFaKGY/dQP3Uli9TRf5kZhj69d17McZ89Dg3a+8rBKZ+UuaM2urxgSInI/gDW8ojBYRFh5mSLlHKzJ7nZR5AAVxm1FAhEFC4PBTLJa11SdkYniIxJxWX8to9xIIdiWKJDs2dVM0AA9c+oDo3NDBzCtuNIO7AAjIjN+XItIlKG90btiMY5jflMvUUbRP0s4xvZ8W7gh23htG7JFXLHWRHZEgwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = " http://localhost:8080/shopping/NotifyServlet";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = " http://localhost:8080/shopping/ReturnServlet";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

